package com.zhuoyue.biz.core.api.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zhuoyue.biz.core.api.domain.base.BaseDoClass;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.zhuoyue.biz.core.api.dto.req.LinkageRelationReqDTO;import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;import org.springframework.beans.BeanUtils;

/**
 * 设备之间的联动关系
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "`tbl_relation_device`")
public class RelationDevice extends BaseDoClass implements Serializable {
    /**
     * 起始设备ID
     */
    @TableField(value = "`start_device_id`")
    private String startDeviceId;

    /**
     * 起始设备类型
     */
    @TableField(value = "`start_device_type`")
    private String startDeviceType;

    /**
     * 起始设备的通用绑定编号
     */
    @TableField(value = "`start_child_od_code`")
    private Integer startChildOdCode;

    /**
     * 结束设备ID
     */
    @TableField(value = "`end_device_id`")
    private String endDeviceId;

    /**
     * 结束设备的类型
     */
    @TableField(value = "`end_device_type`")
    private String endDeviceType;

    private static final long serialVersionUID = 1L;

    public com.zhuoyue.biz.core.api.domain.RelationDevice reqDtoToDo(LinkageRelationReqDTO req, Integer code) {
        BeanUtils.copyProperties(req, this);
        this.startChildOdCode = code;
        return this;
    }
}